/*
 *  Chord.h
 *  SoundController0002
 *
 *  Created by jiro on 11/07/16.
 *  Copyright 2011 jiro music. All rights reserved.
 *
 */

#pragma once

#include "../../sc/Common/Note.h"
#include <vector>
#include <set>

namespace theory0039 {

	class SingleGroupGenerator;

	class Chord
	{
	private:

		std::vector< sc::Note::Id > notes;

		std::set< int > intervalPattern;

		std::vector< SingleGroupGenerator > generators;

		std::vector< sc::Note::Id > generatorStartNotes;

	public:

		Chord();

		Chord( sc::Note::Id note );

		Chord( sc::Note::Id note1, sc::Note::Id note2 );

		Chord( sc::Note::Id note1, sc::Note::Id note2, sc::Note::Id note3 );

		Chord( sc::Note::Id note1, sc::Note::Id note2, sc::Note::Id note3, sc::Note::Id note4 );

		Chord( sc::Note::Id note1, sc::Note::Id note2, sc::Note::Id note3, sc::Note::Id note4, sc::Note::Id note5 );

		bool operator == ( const Chord& rhs ) const;

		bool operator != ( const Chord& rhs ) const;

		void AddNoteId( sc::Note::Id note );

		void AddGenerator( const SingleGroupGenerator& generator, const sc::Note::Id startNote );


		int GetNoteCount() const;

		sc::Note::Id GetNoteIdOfIndex( int index ) const;

		int GetIntervalCount() const;

		sc::Note::Interval GetIntervalOfIndex( int index ) const;

		int GetGeneratorCount() const;

		const SingleGroupGenerator& GetGeneratorOfIndex( int index ) const;

		sc::Note::Id GetGeneratorStartNoteIdOfIndex( int index ) const;

		const std::set< int >& GetIntervalPattern() const;

		void GetNoteIdsOfIntervalIndex( int intervalIndex, sc::Note::Id& note0, sc::Note::Id& note1 ) const;

		void GetNoteIndeciesOfIntervalIndex( int intervalIndex, int& index1, int& index2 ) const;


		bool IsIncludeNote( sc::Note::Id note ) const;

		bool IsIncludeInterval( sc::Note::Interval interval ) const;

		bool AreAllIntervalsSame( const Chord& chord ) const;

		std::string ToString() const;

	};
}
